Add HTTP QUERY method and Accept-Query header references#44568
Add HTTP QUERY method and Accept-Query header references#44568gomestai wants to merge 8 commits into
Conversation
|
Preview URLs (3 pages)
External URLs (1)URL:
(comment last updated: 2026-07-17 04:04:34) |
|
Thanks @gomestai . Thinking aloud:
Upshot, I'm going to see if I can get a little more information on this topic and get back to you. MIght not be very quick. |
|
@gomestai So I've had a short discussion on this.
What you have done is a first step - this really needs
This is a non-trivial bit of documentation. Are you willing to take it on. We could stop at this point if you think this is more than you are willing to commit. However it isn't all that useful at this point because until we have the page there is no spec link or detail on how it used. |
Thanks for the detailed guidance. I just saw this. Yes, I’m happy to take this on. I’ll start on the method page and the Allow-Query header page tomorrow. |
|
Hi everyone! I stumbled upon this PR while looking at the HTTP methods index. Since RFC 10008 was recently accepted, I was wondering: is it advisable to start experimenting with the QUERY method in production soon, or should we wait for broader CDN/cache and server framework support? Thanks for your amazing work documenting this!!! |
Thanks @gomestai |
| Requests using `GET` should only retrieve data and should not contain a request {{Glossary("HTTP Content", "content")}}. | ||
| - {{HTTPMethod("QUERY")}} | ||
| - : The `QUERY` method requests that the target resource process the request content in a safe and idempotent manner, returning the result in the response. | ||
| It is similar to GET, but allows request body content with defined semantics. |
There was a problem hiding this comment.
[mdn-linter] reported by reviewdog 🐶
| It is similar to GET, but allows request body content with defined semantics. | |
| It is similar to GET, but allows request body content with defined semantics. |
@betweencode From my response above:
No one can answer this except you, since it depends on what server frameworks and infrastructure you're using. The advice above seems to indicate that it should mostly just work. IMO there is nothing to stop you experimenting now if you have use cases that would benefit, but you'd want to do robust testing before deploying to production. |
|
I added the header page as |
Adds the HTTP QUERY method defined by RFC 10008 to the HTTP request methods landing page. RFC 10008 defines QUERY as a safe and idempotent HTTP method that carries request content and returns the result of processing that content. The request method table is updated accordingly.
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
| slug: Web/HTTP/Reference/Headers/Accept-Query | ||
| page-type: http-header | ||
| spec-urls: https://www.rfc-editor.org/rfc/rfc10008.html#section-3 | ||
| spec-urls: https://www.rfc-editor.org/info/rfc10008/#name-the-accept-query-header-fie |
There was a problem hiding this comment.
FYI the /info URLs are the ones that get updated to have a rendered description in the spec table. That hasn't been added yet but will be at some point. In any case though, we get to see the URL in this case, which is at least a little interesting.
| This allows a `QUERY` request to be retried automatically without concern that it will cause additional changes to the target resource. | ||
|
|
||
| `QUERY` is useful when the query input is too large or complex for the target URI's query component. | ||
| The request's {{HTTPHeader("Content-Type")}} header is required and determines how the request content is interpreted by the target resource. |
There was a problem hiding this comment.
Thanks @gomestai This is a good start. There are some important omissions with respect to the spec though.
-
Equivalent resource / Content-Location / Location (§2.2–2.4) . It is an important difference between POST/GET and this method that you can get back an URL with a temporary loction for getting the same data again and/or rerunning the query on current data.
2.Content negotiation / 415 handling (§2.1) — servers reject unsupported Content-Type with 415, andAccept-Queryis one way clients discover what's supported. The two pages currently connect only via a "See also" link, not in the body text. You might have a specific example for this in QUERY. -
Redirection and conditional requests probably worth a paragraph.
-
Caching needs to cover that you can cache (like Get) but you have to use the body in the cache key. It stands to reason of course, but I wouldn't have though of it if I hadn't read the spec.
-
Not sure if it is worth talking about range requests.
-
This particular description is slightly messy in that it has "
QUERYis useful when the query input is too large or complex for the target URI's query component.". What query input? Here you are drawing a relationship to using this for search queries using GET that hasn't been established.The spec abstract describes it very abstractly. I think we might be best starting with a line like this "this is what it is intended for" then commenting on the properties that make it suitable for that purpose.
If there ends up being too much in the top section we can add a Description section before the examples. We should look at all the examples, including those in the appendices and see what you can learn from them - might have some stuff worth capturing.
Does that make sense? If it is too much, let me know and perhaps I can help you extend it
There was a problem hiding this comment.
PS MDN is usually a human readable and website developer-centric version of the spec, needed because often specs are written primarily for browser vendors (in this case the spec is actually quite readable).
In any case, we still don't just copy the spec - but we do need to copy the most important nuances of the features use in an accessible way. That's why I lean to starting with "this is mostly for implementing queries that might otherwise be too big to put in a GET", and then covering further details.
This is also the first time there's been a new HTTP method in ages. So there will be eyes on this and we want to make sure we give users the head start they need to use it effectively.
There was a problem hiding this comment.
Thanks, this makes sense. I’ll expand the QUERY page to cover the missing pieces from the spec in a more developer-focused way: equivalent resources with Content-Location/Location, Accept-Query discovery and 415 handling, caching behavior, redirects, and conditional requests.
I’ll also rework the intro so it doesn’t imply that QUERY is only for replacing long GET query strings, but presents that as one common use case.
Description
Adds documentation for the HTTP
QUERYmethod defined by RFC 10008.This PR adds:
QUERYmethod reference pageAccept-Queryheader reference pageMotivation
RFC 10008 defines
QUERYas a safe and idempotent HTTP method that carries request content and returns the result of processing that content. It fills the use case where a request is read-only likeGET, but the query input is too large or complex to fit comfortably in the URI.Additional details
This PR does not add BCD data because there is no explicit browser integration for
QUERYyet. The new reference pages usespec-urlsmetadata instead.The RFC defines the response header as
Accept-Query; this PR uses that name for the header reference page.